<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>账户信息（医疗机构端）</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.group-info {
            margin-top: 10px !important;
            margin-bottom: 0px !important;
        }
        input.innerInput {
            width: 98%;
        }
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>账户信息查看</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">账户管理</a></li>
            <li class="active"><a href="#">账户信息查看</a></li>
        </ol>
     </section>
     
     
     <section class="content" style="min-height:inherit;">
          <form id="form" class="form-horizontal"  method="post">
            <input type="hidden" name=orgId value="${acctInfo.orgId}" />
            
	        <div class="box box-success" style="margin-bottom: 0px;padding-bottom: 10px;">
	           <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right">机构编号：</label>
                     <div class="col-sm-4 text-left" >${acctInfo.orgCode}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right">机构名称：</label>
                     <div id="orgName" class="col-sm-4 text-left">${acctInfo.orgName}</div>
                </div>
                 
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter2" class="col-sm-2 text-right">账户余额：</label>
                     <div id="outstandAmt" class="col-sm-4 text-left">${acctInfo.outstandAmtStr}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right">账户余额更新时间：</label>
                     <div id="outstandAmt" class="col-sm-4 text-left">${acctInfo.outstandAmtUpdDttm}</div>
                </div>
                
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right">可用余额：</label>
                     <div id="availableAmt" class="col-sm-4 text-left">${acctInfo.availableAmtStr}</div>
                     <label for="inputTextAlter1" class="col-sm-2 text-right">可用余额更新时间：</label>
                     <div id="availableAmt" class="col-sm-4 text-left">${acctInfo.availableAmtUpdDttm}</div>
                </div>
                
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter2" class="col-sm-2 text-right">待结算余额：</label>
                     <div id="pendingAmt" class="col-sm-4 text-left">${acctInfo.pendingAmtStr}</div>
                     <label for="inputTextAlter1" class="col-sm-2 text-right">待结算余额更新时间：</label>
                     <div id="availableAmt" class="col-sm-4 text-left">${acctInfo.pendingAmtUpdDttm}</div>
                </div>  
                
	        </div>
        </form>
     </section>
        
    
    
    <section class="content">
        <div class=" box box-primary">
            <div class="box-body">
                <div class=" form-inline">
        
			       <div class="form-group form-group-xs">
                                                                            银行账号： <input class="form-control" type="text" id="bankAcctNo" name="bankAcctNo" placeholder="银行账号" />
                   </div>
                   <div class="form-group form-group-xs">
                                                                            开户人： <input class="form-control" type="text" id="acctHolder"  name="acctHolder" placeholder="开户人" />
                   </div>
                  <div class="form-group form-group-xs">
	                                                             审核状态： 
	                  <select class="form-control"  id="auditStatus" name="auditStatus" >
	                      <option value="">请选择</option>
	                      <option value="0">未审核</option> 
	                      <option value="1">通过</option>
	                      <option value="2">不通过</option>
                      </select>
                   </div>
                    
                   <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm">查询</button>
                    
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
         <div class=" box box-warning bottongroup">
            <label id="add" onclick="add()" class="btn btn-default btn-sm">新 增</label>
        </div>
        
        <form action="${ctx}/acctInfoHosp/toAcctInfoHospAdd.html" method="post" id="BankForm">
       	 	<input type="hidden" id="bankAcctId" name="bankAcctId">
        </form>
   </section>
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
   <script type="text/javascript">
		$(function() {
			$("#gridlist").jqGrid(
			{   url : "getBankAcctInfoHospData.html",
				mtype : "POST",
				datatype : "json",
				autowidth : true,
				shrinkToFit : false,
				height : 255,
				colNames : [ '银行账号id','账户id','银行账号','开户人 ','开户行 ','开户行行号 ','开户行行名','提交时间 ','提交人 ','审核状态 ','审核时间 ','审核人','审核备注','是否默认','操作 '],
				colModel : [
					{name : 'bankAcctId',index : 'bankAcctId', hidden : true,width : 100,align : "center"},
                                {name : 'settleAcctId',index : 'settleAcctId',hidden : true , width : 100,align : "center"},
		            {name : 'bankAcctNo',index : 'bankAcctNo', width : 160,align : "center"},	
					{name : 'acctHolder',index : 'acctHolder',width : 80,align : "center"}, 
					{name : 'depositBank',index : 'depositBank', hidden:true,width : 120,align : "center"},
					{name : 'depositBankNo',index : 'depositBankNo',width : 120,align : "center"},
					{name : 'depositBankName',index : 'depositBankName',width : 200,align : "left",summaryType : 'sum'},
					{name : 'submitTime',index : 'submitDatetime',width : 140,align : "center"},
					{name : 'submitUserName',index : 'submitUser',width : 160,align : "left"},
					{name : 'auditStatusName',index : 'auditStatus',width : 60,align : "center"},
					{name : 'auditTime',index : 'auditTime',width : 140,align : "center"},
					{name : 'auditUserName',index : 'auditUser',width : 160,align : "left"}, 
					{name : 'auditRemark',index : 'auditFemark',width : 80,align : "center"},
					{name : 'isDefaultAcct',index : 'isDefaultAcct',width : 100,align : "center",
                        formatter:function(val, opts,rowdata) {
                            var str ="";
                                if(rowdata.isDefaultAcct == 1){
                                    str =  "是";
                                }else{
                                    str = "否";
                                }
                            return str
                        }
					},
					{name : 'order',index : 'order',width : 180,align : "center",
						formatter:function(val, opts,
								rowdata) {
							var str ="";
							if(rowdata.auditStatusName == "通过"){
								if(rowdata.isDefaultAcct == 1){
									str =  "<a href='${ctx}/bankAcctInfoLog/toBankAcctInfoLog.html?bankAcctId=" +rowdata.bankAcctId  + "' >日志查看</a>";
								}else{
									str = "<a href='javascript:setDefaultAcctInfo(\""+rowdata.bankAcctId+"\",1)'>设为默认</a>"
									+ "<a href='${ctx}/bankAcctInfoLog/toBankAcctInfoLog.html?bankAcctId=" +rowdata.bankAcctId  + "' >日志查看</a>";
								}
							}else{
								str = "<a href='javaScript:edit(\""+rowdata.bankAcctId+"\")'>编辑</a>"
								+ "<a href='${ctx}/bankAcctInfoLog/toBankAcctInfoLog.html?bankAcctId=" +rowdata.bankAcctId  + "' >日志查看</a>";
							}
						 	return str
                   		}
					}
				],
				rowNum : 20,
				rowList : [10, 20, 50,100],
				rownumbers : true,
				pager : "#gridpage",
				viewrecords : true,
				caption : "银行账户列表",
				jsonReader : {
					repeatitems : false,
					id : "ids"
				}
			});
			$("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
			$(window).trigger("resize");
		});
		
		   function getFoucs(obj, rowId) {
		       var text = $.trim($(obj).val());
		       if (text != null && text != "") {
		           var $checkbox = $("#jqg_gridlist_" + rowId);
		           if ($checkbox.is(":not(:checked)")) {
		               $("#gridlist").setSelection(rowId);
		           }
		       }
		   }
		   
		   //查询
		   function gridSerch() {
			   var bankAcctNo = $.trim($("#bankAcctNo").val());
	           var acctHolder = $.trim($("#acctHolder").val());
	           var auditStatus = $.trim($("#auditStatus").val());
	           $("#gridlist").jqGrid('setGridParam',{  
	               datatype:'json',
	               postData:{
	                   "bankAcctNo":bankAcctNo,
	                   "acctHolder":acctHolder,
	                   "auditStatus":auditStatus
	               },
	               page:1
	           }).trigger("reloadGrid"); //重新载入  
		   }
		   
		   //新增银行卡
		     function add() {
		        window.location.href = "${ctx}/acctInfoHosp/toAcctInfoHospAdd.html";
		     }
		     
		   function edit(bankAcctId){
			   $("#bankAcctId").val(bankAcctId);
			   $("#BankForm").submit();
		   }
			   
		   function setDefaultAcctInfo(id,status){
			   $.HN.message.confirm("确定设置为默认地址吗？", "提示信息", "确定").on(function(bool) {
	        		if (bool) {
	        			$.post("setDefaultAcctInfo.html", {
	        				bankAcctId : id,
	        				isDefaultAcct : status
	    	            }, function(result) {
	    	                if (result.success) {
	    	                    var curpage = $("#gridlist").jqGrid('getGridParam', 'page');
	    	                    gridSerch(curpage);
	    	                    $.HN.message.alert("设置成功！", "消息", "success");
	    	                } else {
	    	                    $.HN.message.alert("设置失败！", "消息", "error");
	    	                }
	    	            }, "json");
	        		}
	        	});
		   }
	</script>
</body>
</html>